/* eslint-disable eqeqeq */
import userStore from '@/store/modules/user'

// const { deptId = '' } = userStore.state

const nameId = () => {
  const { deptId = '' } = userStore.state
  return deptId
}
/**
 * 表格配置
 * 机构管理 organ-manage
 */
const headerConfig = {
  'organ-manage': [
    {
      prop: 'deptName',
      name: '机构名称',
      minWidth: 100
    },
    {
      prop: 'deptCode',
      name: '机构编码',
      minWidth: 100
    },
    {
      prop: 'leader',
      name: '负责人',
      minWidth: 100
    },
    {
      prop: 'mobilePhone',
      name: '手机号码',
      minWidth: 100
    },
    {
      prop: 'email',
      name: '邮箱',
      minWidth: 100
    },
    // {
    //   prop: 'delFlag',
    //   name: '删除标识',
    //   minWidth: 100
    // },
    {
      prop: 'remark',
      name: '备注',
      minWidth: 100
    },
    {
      name: '操作',
      width: 200,
      fixed: 'right',
      thStyle: { 'text-align': 'left' },
      operateList: [
        {
          type: 'btnText',
          label: '新增',
          id: 'organ-manage-add',
          authId: 'grass-core:dept:add',
          config: { type: 'text' }
        },
        {
          type: 'btnText',
          label: '编辑',
          id: 'organ-manage-edit',
          authId: 'grass-core:dept:update',
          config: { type: 'text' },
          disabledRules: {
            ruleList: [
              {
                prop: 'deptCode',
                value: '000'
              }
            ]
          },
          hidden: (val) => {
            return val.id == nameId
          }
        },
        {
          type: 'btnText',
          label: '删除',
          id: 'organ-manage-delete',
          authId: 'grass-core:dept:deleteById',
          style: { color: '#f74a5c' },
          config: { type: 'text' },
          disabledRules: {
            ruleList: [
              {
                prop: 'deptCode',
                value: '000'
              }
            ]
          },
          hidden: (val) => {
            return val.id == nameId
          }
        }
      ]
    }
  ]
}

export default {}
export { headerConfig }
